<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function creat_uri($uri, $sub_dir = '')
{
    $CI =& get_instance();

    if($sub_dir != '') {
        if(isset($uri['dir']) && $uri['dir'] != '') $uri['dir'] .= ':'.$sub_dir;

        else $uri['dir'] = $sub_dir;
    }

    return base_url_admin('image/index/'.$CI->uri->assoc_to_uri($uri));
}

function creat_path($uri, $item)
{
    $path = str_replace(':', '/', $uri['dir']).'/'.$item;

    return site_url('uploads/'.$path);
}

function create_dirx($uri, $item){
    $path = str_replace(':', '/', $uri['dir']).'/'.$item;
    return dirname($_SERVER['SCRIPT_FILENAME']).'/uploads/'.$path;
}